import {Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, Relation, UpdateDateColumn} from "typeorm";
import {Tags} from './tag.entity';

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({nullable: false})
    name: string;

    @Column()
    desc: string;

    @Column({type: 'simple-array', nullable: true})
    label: string;

    @CreateDateColumn({type: 'timestamp'})
    createdAt: Date;

    @UpdateDateColumn({type: 'timestamp'})
    updatedAt: Date;

    @OneToMany(() => Tags, tags => tags.user, {
        onUpdate: 'CASCADE',
        onDelete: 'CASCADE'
    })
    tags: Tags[];


}
